package com.tiancheng.trade.settlement.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Auther: liudong
 * @Date: 2024/4/17 19:10
 * @Param ${tags}
 * @Description:0：正常，1：异常,2:未匹配
 */
@Getter
@AllArgsConstructor
public enum PaymentBillStatusEnum {
    SUCCESS("success", "正常"),
    ABNORMAL("abnormal", "数据异常"),
    NO_MATCH("nomatch", "数据未匹配"),
    UP_SUCCESS("upsuccess", "处理后正常");

    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<PaymentBillStatusEnum> found = Arrays.stream(PaymentBillStatusEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
